<?php
class EPMenuDepthOrderProcessor extends EPMenuProcessor{
	public $itemPrefix='item';
	public $linkPrefix='link';
	public $listPrefix='list';
	public $sep='_';


	public function afterParse($menuList){

	}

	public function beforeRender($menuList){
		$this->processListRecursive($menuList);
	}

	public function afterRender($menuList){

	}

	private function processListRecursive($menuList){
		$menuItems=$menuList->getMenuItems();
		foreach($menuItems as $index=>$menuItem){
			$menuItem->addItemCss($this->itemPrefix.$this->sep.$menuItem->menuDepth.$this->sep.$index);
			$menuItem->addLinkCss($this->linkPrefix.$this->sep.$menuItem->menuDepth.$this->sep.$index);
			if($menuItem->hasSubMenu()){
				$submenu=$menuItem->getSubMenu();
				$submenu->addMenuCss($this->listPrefix.$this->sep.$submenu->menuDepth);
				$this->processListRecursive($submenu);
			}
		}
	}
}